//package com.example.webdownloadserver.util;
//
//import com.aliyun.oss.event.ProgressListener;
//import com.zyp.common.upload.utils.OssClientUtil;
//import org.apache.commons.fileupload.disk.DiskFileItem;
//import org.apache.commons.fileupload.disk.DiskFileItemFactory;
//import org.apache.commons.io.IOUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Component;
//import org.springframework.web.multipart.MultipartFile;
//import org.springframework.web.multipart.commons.CommonsMultipartFile;
//
//import javax.annotation.PostConstruct;
//import java.io.InputStream;
//import java.io.OutputStream;
//
//@Component
//public class OssUtil {
//
//	 private static OssClientUtil oss=null;
//	@Autowired
//     private OssClientUtil ossClientUtil;
//
//	@PostConstruct
//	public void inti() {
//		oss = ossClientUtil;
//	}
//
//	public static String  uploadFile2OSS(InputStream inputStream,String fileName,String dir,ProgressListener progressListener) {
//		DiskFileItem fileItem = (DiskFileItem) new DiskFileItemFactory().createItem("file",
//	            MediaType.ALL_VALUE, true, fileName);
//		 try (OutputStream os = fileItem.getOutputStream()) {
//		        IOUtils.copy(inputStream, os);
//		    } catch (Exception e) {
//		        throw new IllegalArgumentException("Invalid file: " + e, e);
//		    }
//
//		    MultipartFile multi = new CommonsMultipartFile(fileItem);
//		return oss.uploadFile2OssPublicRead(multi, dir, false);
//	}
//
//
//
//}
